﻿/****************************************************************************************************************
*                                                                                                               *
* Copyright (C) 2011 5173.com                                                                                   *
* This project may be copied only under the terms of the Apache License 2.0.                                    *
* Please visit the project Home Page http://bqqapicsharp.codeplex.com/ for more detail.                         *
*                                                                                                               *
****************************************************************************************************************/

namespace BQQAPIClient.Core.Utility
{
    using System.Linq;
    using System.Text;

    public class DebugBase
    {
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            this.GetType().GetProperties().ToList().ForEach(p =>
            {
                var o = p.GetValue(this, null);
                sb.Append(p.Name + ": " + o + "|");
            });
            this.GetType().GetFields().ToList().ForEach(p =>
            {
                var o = p.GetValue(this);
                sb.Append(p.Name + ": " + o + "|");
            });
            return sb.ToString();
        }
    }
}
